import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();
        int E = a * 60 + b;
        int F = c * 60 + d;
        int e = F - E;
        int g = e / 60;
        int h = e % 60;
        System.out.println(g + " " + h);

    }
}